package service;

import java.util.List;

import dao.*;
import model.*;



public class RemindService {
	
	  
    private static RemindService remindService= new RemindService();

    
    private RemindDao remindDao=RemindDao.getInstance();
    
    private RemindService() {}
    
    
    public static RemindService getInstance() {
        return remindService;
    }
    
    
    public String getRemindByUid(int uid) {
        List<Room> rooms = remindDao.getRemindByUid(uid);
        StringBuilder str = new StringBuilder();    //2020.3.31今天正好刚学
        StringBuilder ids = new StringBuilder();
        
        if (rooms.size() > 0) {
            str.append("“").append(rooms.get(0).getType()).append("”");
            ids.append(rooms.get(0).getId());
        }
        for(int j = 1; j < rooms.size(); j++) {
            str.append("、").append("“").append(rooms.get(j).getType()).append("”");
            ids.append(",").append(rooms.get(j).getId());

        }
        if (ids.length() > 0) {
            remindDao.updateRemindBatch(ids.toString());//批量设置为已读
        }
        return str.toString();
    }
    


}
